package com.example.helloandroid;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.MotionEvent;
import android.view.View;

public class HelloView extends View {

	private float bSize;
	private float tSize = 1.0f;
	private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
	
	public HelloView(Context context) {
		super(context);
		bSize = paint.getTextSize();
		paint.setColor(0xffe5b154);
		setFocusableInTouchMode(true);
	}

	protected void onDraw(Canvas canvas) {
		canvas.drawColor(0xff3593f1);
		canvas.drawText("Hello Views!", 40, getHeight() / 2, paint);
	}
	
	public boolean onTouchEvent (MotionEvent event) {
		
		if (event.getAction()==MotionEvent.ACTION_UP) {
	    	
	    }
	    if (event.getAction()==MotionEvent.ACTION_DOWN) {
	    	if ( tSize < 10.0f )	tSize += 1.0f;
			else 					tSize = 1.0f;
	    	paint.setTextSize(bSize * tSize);
	    	invalidate();
	    	
			return true;
	    }
	    if (event.getAction()==MotionEvent.ACTION_MOVE) {

	    }
		
		return true;
		
	}
	
}
